package com.api.controller;

import cn.hserver.core.ioc.annotation.Autowired;
import cn.hserver.plugin.web.annotation.Controller;
import cn.hserver.plugin.web.annotation.GET;
import cn.hserver.core.server.util.JsonResult;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;


@Controller(value = "/api/")
public class ApiController {

    @Autowired
    private RedissonClient redissonClient;

    @GET("index")
    public JsonResult index() {
        return JsonResult.ok("hello Tom");
    }


    @GET("testredis")
    public JsonResult testredis() {
        String a = "hello";
        redissonClient.getBucket("user").set(a);
        String test = (String) redissonClient.getBucket("user").get();

        return JsonResult.ok(test);
    }
}
